<?php
$this->pageTitle = 'Asign  My Course';
$this->menu = array(
    array('label' => Yii::t('app', 'Manage Course'), 'url' => array('admin')),
);
?>

<h3><?php echo Yii::t('app', 'Asign Course to user'); ?></h3>

<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'user-form',
    'enableAjaxValidation' => false,
        ));
?>
<div class="form" style="margin: 0px auto;width: 93%;">
<div class="row">
    <div class="classrowLabel"><label>Asign to trainer:</label></div>
    <div class="rowControl">	
        <?php echo $form->dropDownList($model, 'users_id', str_replace('&amp;', '&', GxHtml::encodeEx(GxHtml::listDataEx(Profiles::model()->findAll(array('condition' => 'first_name!="" ', 'order' => 'first_name ASC')), 'user_id', 'first_name'))), array('empty' => 'select asign to user', 'class' => 'selectbox requiredfield')); ?>
    </div>
    <div class="rowControl customeClassvalidate userText" ></div>
</div>
<div class="row">
    <div class="classrowLabel"><label>&nbsp;</label></div>
    <div class="rowControl" style="margin-top: 10px;">
        <?php
        echo GxHtml::submitButton(Yii::t('app', 'Asign to users'), array('class' => 'btn btn-primary', 'id' => 'assigntotrainer'));
        ?>

        <?php
        echo GxHtml::submitButton(Yii::t('app', 'Skip'), array('class' => 'btn btn-danger ', 'id' => 'save_class'));
        ?>
    </div> </div> 

<?php $this->endWidget(); ?>
</div> 

<script>
    $("#assigntotrainer").click(function(){
        var userid=$("#Courses_users_id").val();
        if(userid==''){
            $('.userText').text('Please select user');
            return false;
        }
    });
</script>